local skel = fk.CreateSkill {
  name = "lb__sutu",
  tags = { Skill.Wake }
}

Fk:loadTranslationTable {
  ["lb__sutu"] = "宿途",
  [":lb__sutu"] = "<b>觉醒技</b>，当你进入濒死时，因<a href=':lb__shuyi'><font color='red'>〖书忆〗</font></a>摸过牌的其他角色依次可以交给你任意张手牌，然后你获得<a href=':lb__zhuhuo'><font color='red'>〖逐火〗</font></a>，将〖书忆〗的牌名固定为【杀】。",

  ["#lb__sutu_give"] = "宿途：你可以交给 %dest 任意张手牌",

  ["$lb__sutu1"] = "即便将被遗忘，不要放弃选择。",
  ["$lb__sutu2"] = "记住过去，是为了迈向未来。",
}
skel:addEffect(fk.EnterDying, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and target == player and player:usedSkillTimes(skel.name, Player.HistoryGame) == 0
  end,
  can_wake = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    for _, to in ipairs(room:getOtherPlayers(player)) do
      if to:isAlive() and player:isAlive() and table.contains(player:getTableMark("@[player]lb__shuyi"), to.id) and not to:isKongcheng() then
        local cards = room:askToCards(to, {
          min_num = 1,
          max_num = 999,
          skill_name = skel.name,
          cancelable = true,
          include_equip = false,
          prompt = "#lb__sutu_give::" .. player.id,
        })
        if #cards > 0 then
          room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonGive, skel.name, nil, false, to)
        end
      end
    end
    if player.dead then return end
    room:handleAddLoseSkills(player, "lb__zhuhuo")
    if player.dead then return end
    room:setPlayerMark(player, skel.name, 1)
    if player:getMark("@lb__shuyi-round") ~= 0 then
      room:setPlayerMark(player,  player:getMark("@lb__shuyi-round"), "slash")
    end
  end,
})

skel:addLoseEffect(function(self, player, is_death)
  player.room:setPlayerMark(player, skel.name, 0)
end)

return skel